Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Explicitly bind req/res to context domain in express requestHandler #269

Merged
merged 3 commits into from
Feb 9, 2017

Conversation

LewisJEllis
Copy link
Contributor

Managed to repro/test that this fixes issue in #266. The test case is a little tricky but hopefully makes sense.

/cc @benvinegar @MaxBittker @rwky

@rwky
Copy link

rwky commented Feb 8, 2017

I noticed you put a fix in for node 0.10, this and 0.12 aren't supported by the node core team https://github.com/nodejs/LTS no harm in adding in this case since it's just a test case but in general might not be worth the effort of supporting node < v4

@LewisJEllis
Copy link
Contributor Author

LewisJEllis commented Feb 8, 2017

Yea, we're certainly not holding back any new development/capabilities for the sake of node < v4, but we know we have a number of users still on those older versions (despite node's guidelines/pleading), so we support them as long as it's not a blocker/overly obnoxious to do so (which thus far it hasn't been).

The plan is roughly that when async_hooks shows up in node core, we'll do a new major version that supports only versions of node having async_hooks, and keep the older major version maintenance-only for everything pre-async_hooks.

e.on('done', function () {
// Context won't propagate here without the explicit binding of req/res done in the middleware
setTimeout(function () {
client.getContext().breadcrumbs.length.should.equal(1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that breadcrumbs[0].mesage==='test breadcrumb' here? is there a chance that some other one got added and this doesn't work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, good call, I added an explicit check for that.

Copy link
Contributor

@benvinegar benvinegar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed along #266, did some refreshing on Node's domains documentation, re-read this about 3 times and feel it is sound / accurately covered by the test case.

@LewisJEllis LewisJEllis merged commit 26f9969 into master Feb 9, 2017
@LewisJEllis LewisJEllis deleted the bug/gh-266 branch February 9, 2017 02:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants